package com.alice.router.client;

import com.alice.router.utils.JdbcUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author alice
 * @date 2022/1/7
 * @apiNote
 */
public class RouterTest {
    public static void main(String[] args) throws SQLException {
        Connection connection = JdbcUtil.getConnection();
        String sql = "select * from user limit 10;";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        int columnCount = resultSet.getMetaData().getColumnCount();
        while(resultSet.next()){
            for (int i = 1; i <= columnCount; i++) {
                System.out.print(resultSet.getObject(i)+" ");
            }
            System.out.print("\n");
        }
    }
}
